angular.module('moti.services.ordersService', ['restangular'])
    .factory('OrdersInterface', ['Restangular', 'Auth', function(Restangular, Auth){
        var orders = Restangular.all('admin');
        return {
            //订单查询
            getOrders : function(request_body){
                return orders.customGET(INTERFACE_API.ORDERS, request_body, Auth);
            },
            //获取单个订单
            getOrder : function(order_id){
                return orders.customGET(INTERFACE_API.ORDERS + "/" + order_id, {}, Auth);
            },
            //出票
            addTicket : function(order_id, request_body){
                return orders.customPOST(request_body, INTERFACE_API.ADDTICKET.replace(":order_id", order_id), {}, Auth);
            },
            //退票
            cancelTicket : function(order_id){
                return orders.customPOST({}, INTERFACE_API.CANCEL.replace(":order_id", order_id), {}, Auth);
            },
            //获取批量出票信息
            getBatchInfo : function(order_id){
                return orders.customGET(INTERFACE_API.BATCHINFO.replace(":order_id", order_id), {}, Auth);
            },
            //导出表格
            export : function(request_body){
                return orders.customGET(INTERFACE_API.EXPORT, request_body, Auth);
            }
        }
    }]);